<template>
  <el-container>
  <el-aside style="width: 100px;">
      <el-menu :default-active="this.$route.path" router class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose" :collapse="isCollapse">
        <el-menu-item index="/authorIndex/author">
            <i class="el-icon-s-home"></i>
            <span slot="title">首页</span>
        </el-menu-item>
        <el-submenu index="/authorIndex/authorPresent">
          <template slot="title">
            <i class="el-icon-present"></i>
            <span slot="title">作家福利</span>
          </template>
          <el-menu-item index="/authorIndex/authorPresent/one">作家关怀</el-menu-item>
          <el-menu-item index="/authorIndex/authorPresent/two">作家福利</el-menu-item>
          <el-menu-item index="/authorIndex/authorPresent/three">创作学堂</el-menu-item>
          <el-menu-item index="/authorIndex/authorPresent/four">投稿要求</el-menu-item>
        </el-submenu>
        <el-menu-item index="/authorIndex/create">
          <i class="el-icon-notebook-2"></i>
          <span slot="title">创作</span>
        </el-menu-item>
      </el-menu>
    </el-aside>
    <el-main class="wrap">
      <el-backtop target=".wrap" :visibility-height="10" />
      <router-view/>
    </el-main>
  </el-container>
</template>
<script>
export default {
  name: "authorIndex",
  data() {
    return {
      isCollapse: true
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    }
  }
}
</script>

<style>
.wrap{
  max-height: 100vh; /* 使得最大高度与视口高度一致 */ /* 当内容超出时显示滚动条 */
  height: 100%;
  overflow-x: hidden;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 100px;
  min-height: 400px;
}
.el-menu--popup{
  min-width: 100px !important;
}
</style>